﻿using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Electric.DbMigrator.Migrations
{
    /// <inheritdoc />
    public partial class AddLog : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "EleAuditLog",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    ApiUrl = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, comment: "API接口地址")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Method = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, comment: "接口的方法")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Parameters = table.Column<string>(type: "varchar(1024)", maxLength: 1024, nullable: false, comment: "参数")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ReturnValue = table.Column<string>(type: "longtext", nullable: false, comment: "返回结果")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ExecutionDuration = table.Column<int>(type: "int", nullable: false, comment: "执行时间"),
                    ClientIpAddress = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "客户端IP")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    BrowserInfo = table.Column<string>(type: "varchar(512)", maxLength: 512, nullable: false, comment: "浏览器信息")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AuditLogType = table.Column<int>(type: "int", nullable: false, comment: "日志类型 0:正常日志记录，99：异常日志"),
                    ExceptionMessage = table.Column<string>(type: "varchar(1024)", maxLength: 1024, nullable: false, comment: "异常信息")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Exception = table.Column<string>(type: "varchar(2000)", maxLength: 2000, nullable: false, comment: "详细异常")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatorId = table.Column<long>(type: "bigint", nullable: false, comment: "创建者Id"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "创建时间"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "最后编辑时间")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EleAuditLog", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 1L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1343));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 2L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1370));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 3L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1372));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 4L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1374));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 5L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1377));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 6L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1388));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 7L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1390));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 8L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1391));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 9L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1393));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 10L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1396));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 11L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1397));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 12L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1399));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 13L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1401));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 14L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1495));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 15L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1497));

            migrationBuilder.UpdateData(
                table: "EleRole",
                keyColumn: "Id",
                keyValue: 1L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 640, DateTimeKind.Local).AddTicks(7365));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 1L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1598));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 2L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1602));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 3L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1602));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 4L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1603));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 5L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1604));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 6L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1605));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 7L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1606));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 8L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1606));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 9L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1607));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 10L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1608));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 11L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1609));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 12L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1609));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 13L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1610));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 14L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1611));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 15L,
                column: "CreationTime",
                value: new DateTime(2023, 12, 3, 13, 5, 40, 694, DateTimeKind.Local).AddTicks(1611));

            migrationBuilder.UpdateData(
                table: "EleUser",
                keyColumn: "Id",
                keyValue: 1L,
                columns: new[] { "ConcurrencyStamp", "CreationTime", "PasswordHash" },
                values: new object[] { "c3471d39-0c1d-469f-a5ee-26eec0b9b287", new DateTime(2023, 12, 3, 13, 5, 40, 640, DateTimeKind.Local).AddTicks(7618), "AQAAAAIAAYagAAAAEHkxyS5QWzdOnxBBHf2u+D24LDSoaNUDLvTAFD2FkapTJSVF8SBqah8i8F+8AaduMA==" });

            migrationBuilder.CreateIndex(
                name: "IX_EleAuditLog_AuditLogType",
                table: "EleAuditLog",
                column: "AuditLogType");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "EleAuditLog");

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 1L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9461));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 2L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9481));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 3L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9486));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 4L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9487));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 5L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9489));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 6L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9500));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 7L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9616));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 8L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9619));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 9L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9621));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 10L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9632));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 11L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9634));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 12L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9636));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 13L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9637));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 14L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9639));

            migrationBuilder.UpdateData(
                table: "ElePermission",
                keyColumn: "Id",
                keyValue: 15L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9642));

            migrationBuilder.UpdateData(
                table: "EleRole",
                keyColumn: "Id",
                keyValue: 1L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 116, DateTimeKind.Local).AddTicks(7100));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 1L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9698));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 2L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9701));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 3L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9702));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 4L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9702));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 5L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9703));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 6L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9705));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 7L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9705));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 8L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9706));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 9L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9707));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 10L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9708));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 11L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9709));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 12L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9710));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 13L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9710));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 14L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9711));

            migrationBuilder.UpdateData(
                table: "EleRolePermission",
                keyColumn: "Id",
                keyValue: 15L,
                column: "CreationTime",
                value: new DateTime(2023, 11, 30, 15, 31, 36, 177, DateTimeKind.Local).AddTicks(9711));

            migrationBuilder.UpdateData(
                table: "EleUser",
                keyColumn: "Id",
                keyValue: 1L,
                columns: new[] { "ConcurrencyStamp", "CreationTime", "PasswordHash" },
                values: new object[] { "94e7777e-c7a1-49df-8a6a-3927d6a3134c", new DateTime(2023, 11, 30, 15, 31, 36, 116, DateTimeKind.Local).AddTicks(7304), "AQAAAAIAAYagAAAAECpHG4EI5HnQmQ/mySYGKMDkDEieeQXx2CL/fEE+It2MDi5Qge6osuiU5aGGYrd8EQ==" });
        }
    }
}
